package com.lancoo.znbkxx.teacher.widget

import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.widget.PopupWindow
import android.widget.RadioGroup
import com.lancoo.znbkxx.teacher.R
import kotlinx.android.synthetic.main.view_filter_paper.view.*

/**
 * Created by wealive on 2021/3/26.
 *
 *
 */
class PaperFilterWindow(context: Context, onClickListener: View.OnClickListener,
                        onCheckedChangeListener: RadioGroup.OnCheckedChangeListener) :
        PopupWindow() {
    init {
        val contentView = LayoutInflater.from(context).inflate(R.layout.view_filter_paper, null)
        contentView.apply {
            rg_publish.setOnCheckedChangeListener(onCheckedChangeListener)
            rg_finish.setOnCheckedChangeListener(onCheckedChangeListener)
            iv_reset.setOnClickListener(onClickListener)
            iv_config.setOnClickListener(onClickListener)
        }
        this.contentView = contentView
        this.width = WindowManager.LayoutParams.MATCH_PARENT
        this.height = WindowManager.LayoutParams.WRAP_CONTENT
        this.isOutsideTouchable = false
        this.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
        this.isFocusable = true
        update()
    }
}